package com.xlh.dto.course;

import com.xlh.enums.course.ChapterResourceViewEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 章节
 * <p>
 * Created by lx on 2019/2/11 0011.
 */
@Data
public class ChapterDTO {

    @ApiModelProperty(value = "章节id/任务id")
    private Long id;

    @ApiModelProperty(value = "类型")
    private Integer type;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "资源是否存在 true：存在 false：不存在")
    private Boolean resourceExist;

    @ApiModelProperty(value = "是否显示 true：显示 false：隐藏或者置灰")
    private Boolean show;

    @ApiModelProperty(value = "隐藏描述")
    private String hideDescription;

    @ApiModelProperty(value = "是否调用虚机请求 true：调用 false：不需要调用")
    private Boolean invokingVMRequests;

    @ApiModelProperty(value = "评价状态 PaperStatusEnum 这个枚举的值")
    private String evaluatStatus;

    @ApiModelProperty(value = "最近学习标识 0：未学习 1：已学习")
    private Integer recentlyStudiedFlag = 0;

    @ApiModelProperty(value = "章节id")
    private Long chapterId;

    public boolean isInvokingVMRequests() {
        return ChapterResourceViewEnum.EXPERIMENT.getCode() == type ? true : false;
    }

    @ApiModelProperty(value = "是否是实验课")
    private boolean experimentCourseFlag = false;

    public ChapterDTO(Integer type, String name, Long id, Long chapterId) {
        this.type = type;
        this.name = name;
        this.id = id;
        this.chapterId = chapterId;
    }
}
